<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <title></title>

    <link rel="stylesheet" type="text/css" media="screen" href="<?= THEMEPATH ?>/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" media="screen" href="<?= THEMEPATH ?>/css/font-awesome.min.css"/>
    <link rel="stylesheet" type="text/css" media="screen" href="<?= THEMEPATH ?>/css/front.css"/>
    <link rel="stylesheet" type="text/css" media="screen" href="<?= THEMEPATH ?>/css/bootstrap-dialog.min.css"/>

</head>
<body>

<!-- Nav -->
<nav class="nav navbar-static-side">
    <div class="nav-header">
        <img src="<?= THEMEPATH ?>/images/logo.jpeg"/>

    </div>
    <ul id="menu" class="nav">
        <li class="active">
            <a href="#">
                <i class="fa fa-user fa-lg"></i>
                用户菜单
            </a>
            <ul class="nav nav-second-level">
                <li>
                    <a href="javascript:void(0);" data-url="<?=site_url('main/show')?>">
                        <i class="fa fa-list"></i>
                        <span>考试列表</span>

                    </a>
                </li>
            </ul>
        </li>
        <?php if ($user['level'] > 7): ?>
            <li>
                <a href="#">
                    <i class="fa fa-gear"></i>
                    考试管理
                </a>
                <ul class="nav nav-second-level">
                    <li>
                        <a href="javascript:void(0);" data-url="<?= site_url('admin/category') ?>">
                            <i class="fa fa-cubes"></i>
                            科目管理
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0);" data-url="<?= site_url('admin/group') ?>">
                            <i class="fa fa-group"></i>
                            分组管理
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0);" data-url="<?= site_url('admin/question') ?>">
                            <i class="fa fa-question-circle-o"></i>
                            试题管理
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0);" data-url="<?= site_url('admin/page') ?>">
                            <i class="fa fa-sticky-note"></i>
                            试卷管理
                        </a>
                    </li>
                    <li>
                        <a href="javascript:void(0);" data-url="<?= site_url('admin/room') ?>">
                            <i class="fa fa-th-large"></i>
                            考场管理
                        </a>
                    </li>
                </ul>
            </li>
        <?php endif; ?>
        <?php if ($user['level'] == 9): ?>
        <li>
            <a href="#">
                <i class="fa fa-gears"></i>
                系统管理
            </a>
            <ul class="nav nav-second-level">
                <li>
                    <a href="javascript:void(0);" data-url="<?= site_url('admin/city') ?>">
                        <i class="fa fa-sitemap"></i>
                        地区管理
                    </a>
                </li>

                <li>
                    <a href="javascript:void(0);" data-url="<?= site_url('admin/type') ?>">
                        <i class="fa fa-th-list"></i>
                        题型管理
                    </a>
                </li>
                <li>
                    <a href="javascript:void(0);" data-url="<?= site_url('admin/users') ?>">
                        <i class="fa fa-user-o"></i>
                        用户管理
                    </a>
                </li>
            </ul>
        </li>
        <?php endif;?>
    </ul>
</nav>
<!-- End Nav -->
<!-- Main -->

<div class="main">
    <nav class="navbar fixed navbar-default">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <a class="navbar-brand" href="javascript:void(0);">
                    <img src="<?= THEMEPATH ?>/images/avatar/<?= $user['avatar'] ? : 'default.jpg' ?>" id="userAvatar" class="img-circle" title="<?= $user_title ?>"/>
                </a>
            </div>
            <ul class="nav navbar-nav">
                <li class="active">
                    <a href="javascript:void(0);" data-url="<?= site_url('user/profile') ?>"><?= $user['name'] ?></a>
                </li>
            </ul>

            <!-- Collect the nav links, forms, and other content for toggling -->

            <ul class="nav navbar-nav navbar-right">

                <li>
                    <a href="javascript:void(0);" data-open="<?= site_url('user/modify') ?>" title="修改密码" data-size="m">
                        <i class="fa fa-key"></i>
                    </a>
                </li>

                <li>
                    <a href="<?= site_url('/login/out') ?>">
                        <i class="fa fa-sign-out"></i>
                        退出登录
                    </a>
                </li>

            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </nav>
    <div class="container-fluid">
        <div class="main-content">

        </div>
    </div>
</div>
</div>
<!-- End Main -->
<script src="<?= THEMEPATH ?>/js/jquery.min.js"></script>

<!--[if lt IE 9]>
<script src="<?=THEMEPATH?>/js/html5shiv.min.js"></script>
<script src="<?=THEMEPATH?>/js/respond.min.js"></script>
<script src="<?=THEMEPATH?>/css/font-awesome-ie7.min.css"></script>
<![endif]-->
<script src="<?= THEMEPATH ?>/js/jquery.metisMenu.js"></script>
<script src="<?= THEMEPATH ?>/js/jquery.cookie.js"></script>
<script src="<?= THEMEPATH ?>/js/bootstrap.min.js"></script>
<script src="<?= THEMEPATH ?>/js/bootstrap-dialog.min.js"></script>
<script src="<?= THEMEPATH ?>/js/custom.js"></script>

<script type="text/javascript">
    $(function () {
        var url = $.cookie('url') ? $.cookie('url') : "<?=site_url('main/show')?>";
        var li = $('#menu').find('[data-url="' + url + '"]');
        if (li.length > 0) {
            $('#menu').find('li.active').removeClass('active');
            li.parents('li').addClass('active');
            li.addClass('active');
            $('.main-content').load(url);
        } else {
            $('#menu li:first').find('ul li:first').addClass('active');
        }

        $('#menu').metisMenu();

        $('.nav a').click(function () {
            var li = $(this).parent('li');
            var href = $(this).data('url');
            $.cookie('li', li);
            $.cookie('url', href);
            if (href) {
                $('.main-content').load(href);
                $('#menu').find('.nav-second-level li.active').removeClass('active');
                li.addClass('active');
            }
        });

    });
</script>
</body>
</html>